package com.theta.common.base.swagger.doc.listener;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.environment.EnvironmentChangeEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;



@Slf4j
@Component
public class NacosConfigChangeListener implements ApplicationListener<EnvironmentChangeEvent> {
	
	@Autowired
    private ConfigurableEnvironment environment;
	
	
	@Override
	public void onApplicationEvent(EnvironmentChangeEvent event) {
		for(String key:event.getKeys()) {
			log.info("NacosConfigChangeListener {},{}",key,environment.getProperty(key));
		}
		
	}

}
